#ifndef CONNECTIONTHREAD_H
#define CONNECTIONTHREAD_H

#include <QThread>
#include <QTcpSocket>
#include <QDebug>

class ConnectionThread : public QThread
{
    Q_OBJECT
public:
    explicit ConnectionThread(int Descriptor, QObject *parent = 0);
    void run();
    void relayData(QByteArray data);
    QString getIP(); // TODO
    QString getUsername(); // TODO
    QList<QString> getCharacterData(); // TODO
    bool setCharacterData(QList<QString>); // TODO
signals:
    void error(QTcpSocket::SocketError socketerror);
    void relay(QByteArray data);
public slots:
    void readyRead();
    void disconnected();
    void writeToSocket(QByteArray data);
private:
    QTcpSocket *socket; // connection socket
    int Descriptor; // Socket ID descriptor
};

#endif // CONNECTIONTHREAD_H
